package tech.aistar.day11;

/**
 * 本类用来演示: 泛型类 - 泛型指定在类上
 *
 * @author: success
 * @date: 2021/3/22 2:43 下午
 */
public class MySet<T> {

    public void add(T t){
        System.out.println(t);
    }

    public void find(T t){
        System.out.println(t);
    }
}

//泛型定义在方法上
class MyMethod{

    public <T>void add(T t){
        System.out.println(t);
    }
    public <T>void test(T t){
        System.out.println(t);
    }

}

class TestDemo{
    public static void main(String[] args) {
        MySet<String> st = new MySet<>();
        st.add("ok");

        MySet<Integer> set = new MySet<>();
        set.find(10);

        MyMethod m = new MyMethod();
        m.add(10);
    }
}